\(\int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx\) [396]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F(-1)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 173 \[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\frac {\sqrt {-1+\sqrt {2}} \arctan \left (\frac {3-2 \sqrt {2}+\left (1-\sqrt {2}\right ) \tan (e+f x)}{\sqrt {2 \left (-7+5 \sqrt {2}\right )} \sqrt {1+\tan (e+f x)}}\right )}{f}+\frac {\sqrt {1+\sqrt {2}} \text {arctanh}\left (\frac {3+2 \sqrt {2}+\left (1+\sqrt {2}\right ) \tan (e+f x)}{\sqrt {2 \left (7+5 \sqrt {2}\right )} \sqrt {1+\tan (e+f x)}}\right )}{f}-\frac {2 \sqrt {1+\tan (e+f x)}}{f}+\frac {2 (1+\tan (e+f x))^{5/2}}{5 f} \]

[Out]

arctan((3-2*2^(1/2)+(1-2^(1/2))*tan(f*x+e))/(-14+10*2^(1/2))^(1/2)/(1+tan(f*x+e))^(1/2))*(2^(1/2)-1)^(1/2)/f+a
rctanh((3+2*2^(1/2)+(1+2^(1/2))*tan(f*x+e))/(14+10*2^(1/2))^(1/2)/(1+tan(f*x+e))^(1/2))*(1+2^(1/2))^(1/2)/f-2*
(1+tan(f*x+e))^(1/2)/f+2/5*(1+tan(f*x+e))^(5/2)/f

Rubi [A] (verified)

Time = 0.21 (sec) , antiderivative size = 173, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3624, 3563, 12, 3617, 3616, 209, 213} \[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\frac {\sqrt {\sqrt {2}-1} \arctan \left (\frac {\left (1-\sqrt {2}\right ) \tan (e+f x)-2 \sqrt {2}+3}{\sqrt {2 \left (5 \sqrt {2}-7\right )} \sqrt {\tan (e+f x)+1}}\right )}{f}+\frac {\sqrt {1+\sqrt {2}} \text {arctanh}\left (\frac {\left (1+\sqrt {2}\right ) \tan (e+f x)+2 \sqrt {2}+3}{\sqrt {2 \left (7+5 \sqrt {2}\right )} \sqrt {\tan (e+f x)+1}}\right )}{f}+\frac {2 (\tan (e+f x)+1)^{5/2}}{5 f}-\frac {2 \sqrt {\tan (e+f x)+1}}{f} \]

[In]

Int[Tan[e + f*x]^2*(1 + Tan[e + f*x])^(3/2),x]

[Out]

(Sqrt[-1 + Sqrt[2]]*ArcTan[(3 - 2*Sqrt[2] + (1 - Sqrt[2])*Tan[e + f*x])/(Sqrt[2*(-7 + 5*Sqrt[2])]*Sqrt[1 + Tan
[e + f*x]])])/f + (Sqrt[1 + Sqrt[2]]*ArcTanh[(3 + 2*Sqrt[2] + (1 + Sqrt[2])*Tan[e + f*x])/(Sqrt[2*(7 + 5*Sqrt[
2])]*Sqrt[1 + Tan[e + f*x]])])/f - (2*Sqrt[1 + Tan[e + f*x]])/f + (2*(1 + Tan[e + f*x])^(5/2))/(5*f)

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 3563

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + b*Tan[c + d*x])^(n - 1)/(d*(n - 1))
), x] + Int[(a^2 - b^2 + 2*a*b*Tan[c + d*x])*(a + b*Tan[c + d*x])^(n - 2), x] /; FreeQ[{a, b, c, d}, x] && NeQ
[a^2 + b^2, 0] && GtQ[n, 1]

Rule 3616

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/Sqrt[(a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]], x_Symbol] :> Dist[-2*(
d^2/f), Subst[Int[1/(2*b*c*d - 4*a*d^2 + x^2), x], x, (b*c - 2*a*d - b*d*Tan[e + f*x])/Sqrt[a + b*Tan[e + f*x]
]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && EqQ[2
*a*c*d - b*(c^2 - d^2), 0]

Rule 3617

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/Sqrt[(a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]], x_Symbol] :> With[{q =
 Rt[a^2 + b^2, 2]}, Dist[1/(2*q), Int[(a*c + b*d + c*q + (b*c - a*d + d*q)*Tan[e + f*x])/Sqrt[a + b*Tan[e + f*
x]], x], x] - Dist[1/(2*q), Int[(a*c + b*d - c*q + (b*c - a*d - d*q)*Tan[e + f*x])/Sqrt[a + b*Tan[e + f*x]], x
], x]] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && NeQ[2
*a*c*d - b*(c^2 - d^2), 0] && (PerfectSquareQ[a^2 + b^2] || RationalQ[a, b, c, d])

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps \begin{align*} \text {integral}& = \frac {2 (1+\tan (e+f x))^{5/2}}{5 f}-\int (1+\tan (e+f x))^{3/2} \, dx \\ & = -\frac {2 \sqrt {1+\tan (e+f x)}}{f}+\frac {2 (1+\tan (e+f x))^{5/2}}{5 f}-\int \frac {2 \tan (e+f x)}{\sqrt {1+\tan (e+f x)}} \, dx \\ & = -\frac {2 \sqrt {1+\tan (e+f x)}}{f}+\frac {2 (1+\tan (e+f x))^{5/2}}{5 f}-2 \int \frac {\tan (e+f x)}{\sqrt {1+\tan (e+f x)}} \, dx \\ & = -\frac {2 \sqrt {1+\tan (e+f x)}}{f}+\frac {2 (1+\tan (e+f x))^{5/2}}{5 f}+\frac {\int \frac {1+\left (-1-\sqrt {2}\right ) \tan (e+f x)}{\sqrt {1+\tan (e+f x)}} \, dx}{\sqrt {2}}-\frac {\int \frac {1+\left (-1+\sqrt {2}\right ) \tan (e+f x)}{\sqrt {1+\tan (e+f x)}} \, dx}{\sqrt {2}} \\ & = -\frac {2 \sqrt {1+\tan (e+f x)}}{f}+\frac {2 (1+\tan (e+f x))^{5/2}}{5 f}-\frac {\left (4-3 \sqrt {2}\right ) \text {Subst}\left (\int \frac {1}{2 \left (-1+\sqrt {2}\right )-4 \left (-1+\sqrt {2}\right )^2+x^2} \, dx,x,\frac {1-2 \left (-1+\sqrt {2}\right )-\left (-1+\sqrt {2}\right ) \tan (e+f x)}{\sqrt {1+\tan (e+f x)}}\right )}{f}-\frac {\left (4+3 \sqrt {2}\right ) \text {Subst}\left (\int \frac {1}{2 \left (-1-\sqrt {2}\right )-4 \left (-1-\sqrt {2}\right )^2+x^2} \, dx,x,\frac {1-2 \left (-1-\sqrt {2}\right )-\left (-1-\sqrt {2}\right ) \tan (e+f x)}{\sqrt {1+\tan (e+f x)}}\right )}{f} \\ & = \frac {\sqrt {-1+\sqrt {2}} \arctan \left (\frac {3-2 \sqrt {2}+\left (1-\sqrt {2}\right ) \tan (e+f x)}{\sqrt {2 \left (-7+5 \sqrt {2}\right )} \sqrt {1+\tan (e+f x)}}\right )}{f}+\frac {\sqrt {1+\sqrt {2}} \text {arctanh}\left (\frac {3+2 \sqrt {2}+\left (1+\sqrt {2}\right ) \tan (e+f x)}{\sqrt {2 \left (7+5 \sqrt {2}\right )} \sqrt {1+\tan (e+f x)}}\right )}{f}-\frac {2 \sqrt {1+\tan (e+f x)}}{f}+\frac {2 (1+\tan (e+f x))^{5/2}}{5 f} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.42 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.58 \[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\frac {\frac {10 \text {arctanh}\left (\frac {\sqrt {1+\tan (e+f x)}}{\sqrt {1-i}}\right )}{\sqrt {1-i}}+\frac {10 \text {arctanh}\left (\frac {\sqrt {1+\tan (e+f x)}}{\sqrt {1+i}}\right )}{\sqrt {1+i}}+2 \sqrt {1+\tan (e+f x)} \left (-4+2 \tan (e+f x)+\tan ^2(e+f x)\right )}{5 f} \]

[In]

Integrate[Tan[e + f*x]^2*(1 + Tan[e + f*x])^(3/2),x]

[Out]

((10*ArcTanh[Sqrt[1 + Tan[e + f*x]]/Sqrt[1 - I]])/Sqrt[1 - I] + (10*ArcTanh[Sqrt[1 + Tan[e + f*x]]/Sqrt[1 + I]
])/Sqrt[1 + I] + 2*Sqrt[1 + Tan[e + f*x]]*(-4 + 2*Tan[e + f*x] + Tan[e + f*x]^2))/(5*f)

Maple [A] (verified)

Time = 0.69 (sec) , antiderivative size = 233, normalized size of antiderivative = 1.35

method result size
derivativedivides \(\frac {\frac {2 \left (1+\tan \left (f x +e \right )\right )^{\frac {5}{2}}}{5}-2 \sqrt {1+\tan \left (f x +e \right )}+\frac {\sqrt {2}\, \left (\frac {\sqrt {2+2 \sqrt {2}}\, \ln \left (1+\sqrt {2}+\sqrt {2+2 \sqrt {2}}\, \sqrt {1+\tan \left (f x +e \right )}+\tan \left (f x +e \right )\right )}{2}+\frac {2 \left (1-\sqrt {2}\right ) \arctan \left (\frac {\sqrt {2+2 \sqrt {2}}+2 \sqrt {1+\tan \left (f x +e \right )}}{\sqrt {-2+2 \sqrt {2}}}\right )}{\sqrt {-2+2 \sqrt {2}}}\right )}{2}+\frac {\sqrt {2}\, \left (-\frac {\sqrt {2+2 \sqrt {2}}\, \ln \left (1+\sqrt {2}-\sqrt {2+2 \sqrt {2}}\, \sqrt {1+\tan \left (f x +e \right )}+\tan \left (f x +e \right )\right )}{2}+\frac {2 \left (1-\sqrt {2}\right ) \arctan \left (\frac {2 \sqrt {1+\tan \left (f x +e \right )}-\sqrt {2+2 \sqrt {2}}}{\sqrt {-2+2 \sqrt {2}}}\right )}{\sqrt {-2+2 \sqrt {2}}}\right )}{2}}{f}\) \(233\)
default \(\frac {\frac {2 \left (1+\tan \left (f x +e \right )\right )^{\frac {5}{2}}}{5}-2 \sqrt {1+\tan \left (f x +e \right )}+\frac {\sqrt {2}\, \left (\frac {\sqrt {2+2 \sqrt {2}}\, \ln \left (1+\sqrt {2}+\sqrt {2+2 \sqrt {2}}\, \sqrt {1+\tan \left (f x +e \right )}+\tan \left (f x +e \right )\right )}{2}+\frac {2 \left (1-\sqrt {2}\right ) \arctan \left (\frac {\sqrt {2+2 \sqrt {2}}+2 \sqrt {1+\tan \left (f x +e \right )}}{\sqrt {-2+2 \sqrt {2}}}\right )}{\sqrt {-2+2 \sqrt {2}}}\right )}{2}+\frac {\sqrt {2}\, \left (-\frac {\sqrt {2+2 \sqrt {2}}\, \ln \left (1+\sqrt {2}-\sqrt {2+2 \sqrt {2}}\, \sqrt {1+\tan \left (f x +e \right )}+\tan \left (f x +e \right )\right )}{2}+\frac {2 \left (1-\sqrt {2}\right ) \arctan \left (\frac {2 \sqrt {1+\tan \left (f x +e \right )}-\sqrt {2+2 \sqrt {2}}}{\sqrt {-2+2 \sqrt {2}}}\right )}{\sqrt {-2+2 \sqrt {2}}}\right )}{2}}{f}\) \(233\)

[In]

int(tan(f*x+e)^2*(1+tan(f*x+e))^(3/2),x,method=_RETURNVERBOSE)

[Out]

1/f*(2/5*(1+tan(f*x+e))^(5/2)-2*(1+tan(f*x+e))^(1/2)+1/2*2^(1/2)*(1/2*(2+2*2^(1/2))^(1/2)*ln(1+2^(1/2)+(2+2*2^
(1/2))^(1/2)*(1+tan(f*x+e))^(1/2)+tan(f*x+e))+2*(1-2^(1/2))/(-2+2*2^(1/2))^(1/2)*arctan(((2+2*2^(1/2))^(1/2)+2
*(1+tan(f*x+e))^(1/2))/(-2+2*2^(1/2))^(1/2)))+1/2*2^(1/2)*(-1/2*(2+2*2^(1/2))^(1/2)*ln(1+2^(1/2)-(2+2*2^(1/2))
^(1/2)*(1+tan(f*x+e))^(1/2)+tan(f*x+e))+2*(1-2^(1/2))/(-2+2*2^(1/2))^(1/2)*arctan((2*(1+tan(f*x+e))^(1/2)-(2+2
*2^(1/2))^(1/2))/(-2+2*2^(1/2))^(1/2))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 346 vs. \(2 (134) = 268\).

Time = 0.25 (sec) , antiderivative size = 346, normalized size of antiderivative = 2.00 \[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=-\frac {5 \, \sqrt {2} f \sqrt {\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} + 1}{f^{2}}} \log \left (\sqrt {2} {\left (f^{3} \sqrt {-\frac {1}{f^{4}}} - f\right )} \sqrt {\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} + 1}{f^{2}}} + 2 \, \sqrt {\tan \left (f x + e\right ) + 1}\right ) - 5 \, \sqrt {2} f \sqrt {\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} + 1}{f^{2}}} \log \left (-\sqrt {2} {\left (f^{3} \sqrt {-\frac {1}{f^{4}}} - f\right )} \sqrt {\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} + 1}{f^{2}}} + 2 \, \sqrt {\tan \left (f x + e\right ) + 1}\right ) - 5 \, \sqrt {2} f \sqrt {-\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} - 1}{f^{2}}} \log \left (\sqrt {2} {\left (f^{3} \sqrt {-\frac {1}{f^{4}}} + f\right )} \sqrt {-\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} - 1}{f^{2}}} + 2 \, \sqrt {\tan \left (f x + e\right ) + 1}\right ) + 5 \, \sqrt {2} f \sqrt {-\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} - 1}{f^{2}}} \log \left (-\sqrt {2} {\left (f^{3} \sqrt {-\frac {1}{f^{4}}} + f\right )} \sqrt {-\frac {f^{2} \sqrt {-\frac {1}{f^{4}}} - 1}{f^{2}}} + 2 \, \sqrt {\tan \left (f x + e\right ) + 1}\right ) - 4 \, {\left (\tan \left (f x + e\right )^{2} + 2 \, \tan \left (f x + e\right ) - 4\right )} \sqrt {\tan \left (f x + e\right ) + 1}}{10 \, f} \]

[In]

integrate(tan(f*x+e)^2*(1+tan(f*x+e))^(3/2),x, algorithm="fricas")

[Out]

-1/10*(5*sqrt(2)*f*sqrt((f^2*sqrt(-1/f^4) + 1)/f^2)*log(sqrt(2)*(f^3*sqrt(-1/f^4) - f)*sqrt((f^2*sqrt(-1/f^4)
+ 1)/f^2) + 2*sqrt(tan(f*x + e) + 1)) - 5*sqrt(2)*f*sqrt((f^2*sqrt(-1/f^4) + 1)/f^2)*log(-sqrt(2)*(f^3*sqrt(-1
/f^4) - f)*sqrt((f^2*sqrt(-1/f^4) + 1)/f^2) + 2*sqrt(tan(f*x + e) + 1)) - 5*sqrt(2)*f*sqrt(-(f^2*sqrt(-1/f^4)
- 1)/f^2)*log(sqrt(2)*(f^3*sqrt(-1/f^4) + f)*sqrt(-(f^2*sqrt(-1/f^4) - 1)/f^2) + 2*sqrt(tan(f*x + e) + 1)) + 5
*sqrt(2)*f*sqrt(-(f^2*sqrt(-1/f^4) - 1)/f^2)*log(-sqrt(2)*(f^3*sqrt(-1/f^4) + f)*sqrt(-(f^2*sqrt(-1/f^4) - 1)/
f^2) + 2*sqrt(tan(f*x + e) + 1)) - 4*(tan(f*x + e)^2 + 2*tan(f*x + e) - 4)*sqrt(tan(f*x + e) + 1))/f

Sympy [F]

\[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\int \left (\tan {\left (e + f x \right )} + 1\right )^{\frac {3}{2}} \tan ^{2}{\left (e + f x \right )}\, dx \]

[In]

integrate(tan(f*x+e)**2*(1+tan(f*x+e))**(3/2),x)

[Out]

Integral((tan(e + f*x) + 1)**(3/2)*tan(e + f*x)**2, x)

Maxima [F]

\[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\int { {\left (\tan \left (f x + e\right ) + 1\right )}^{\frac {3}{2}} \tan \left (f x + e\right )^{2} \,d x } \]

[In]

integrate(tan(f*x+e)^2*(1+tan(f*x+e))^(3/2),x, algorithm="maxima")

[Out]

integrate((tan(f*x + e) + 1)^(3/2)*tan(f*x + e)^2, x)

Giac [F(-1)]

Timed out. \[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\text {Timed out} \]

[In]

integrate(tan(f*x+e)^2*(1+tan(f*x+e))^(3/2),x, algorithm="giac")

[Out]

Timed out

Mupad [B] (verification not implemented)

Time = 0.99 (sec) , antiderivative size = 103, normalized size of antiderivative = 0.60 \[ \int \tan ^2(e+f x) (1+\tan (e+f x))^{3/2} \, dx=\frac {2\,{\left (\mathrm {tan}\left (e+f\,x\right )+1\right )}^{5/2}}{5\,f}-\frac {2\,\sqrt {\mathrm {tan}\left (e+f\,x\right )+1}}{f}-\mathrm {atan}\left (f\,\sqrt {\frac {\frac {1}{2}-\frac {1}{2}{}\mathrm {i}}{f^2}}\,\sqrt {\mathrm {tan}\left (e+f\,x\right )+1}\,1{}\mathrm {i}\right )\,\sqrt {\frac {\frac {1}{2}-\frac {1}{2}{}\mathrm {i}}{f^2}}\,2{}\mathrm {i}-\mathrm {atan}\left (f\,\sqrt {\frac {\frac {1}{2}+\frac {1}{2}{}\mathrm {i}}{f^2}}\,\sqrt {\mathrm {tan}\left (e+f\,x\right )+1}\,1{}\mathrm {i}\right )\,\sqrt {\frac {\frac {1}{2}+\frac {1}{2}{}\mathrm {i}}{f^2}}\,2{}\mathrm {i} \]

[In]

int(tan(e + f*x)^2*(tan(e + f*x) + 1)^(3/2),x)

[Out]

(2*(tan(e + f*x) + 1)^(5/2))/(5*f) - (2*(tan(e + f*x) + 1)^(1/2))/f - atan(f*((1/2 - 1i/2)/f^2)^(1/2)*(tan(e +
 f*x) + 1)^(1/2)*1i)*((1/2 - 1i/2)/f^2)^(1/2)*2i - atan(f*((1/2 + 1i/2)/f^2)^(1/2)*(tan(e + f*x) + 1)^(1/2)*1i
)*((1/2 + 1i/2)/f^2)^(1/2)*2i